﻿using Microsoft.ManagementConsole;
using System;

namespace Google.Apps.MMC
    {
    class CustomNode : ScopeNode
        {

        public event EventHandler Refresh;
        public event EventHandler Delete;
        public event EventHandler<StringEventArgs> Action;
        public event EventHandler Expand;
        public event EventHandler Print;
        public event EventHandler<StringEventArgs> Rename;
        public event EventHandler AddPropertyPages;



        protected override void OnRefresh(AsyncStatus status)
            {
 	        base.OnRefresh(status);
            if (Refresh != null)
                {
                Refresh(null, EventArgs.Empty);
                }
            }

        protected override void OnDelete(SyncStatus status)
            {
            base.OnDelete(status);
            if (Delete != null)
                {
                Delete(null, EventArgs.Empty);
                }
            }

        protected override void OnAction(Action action, AsyncStatus status)
            {
                if (Action != null)
                    {
                    Action(null, new StringEventArgs(action.DisplayName));
                    }
            }

        protected override void OnExpand(AsyncStatus status)
            {
            base.OnExpand(status);
            if (Expand != null)
                {
                Expand(null, EventArgs.Empty);
                }
            }

        protected override void OnPrint(SyncStatus status)
            {
            base.OnPrint(status);
            if (Print != null)
                {
                Print(null, EventArgs.Empty);
                }
            }

        protected override void OnRename(string newText, SyncStatus status)
            {
            base.OnRename(newText, status);
            if (Rename != null)
                {
                Rename(null, new StringEventArgs(newText));
                }
            }

        protected override void OnAddPropertyPages(PropertyPageCollection propertyPageCollection)
            {
            base.OnAddPropertyPages(propertyPageCollection);
            if (AddPropertyPages != null)
                {
                AddPropertyPages(propertyPageCollection, EventArgs.Empty);
                }
            }



        }
    }
